package cn.funnymap.lgis.mp.entity;

import cn.funnymap.lgis.mp.handler.LTreeTypeHandler;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.ibatis.type.BaseTypeHandler;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;

import java.util.ArrayList;
import java.util.List;

/**
 * @author jiaoxn
 */
@EqualsAndHashCode(callSuper = true)
@Data
@ConditionalOnClass(BaseTypeHandler.class)
public abstract class BaseCatalogNodeEntity extends BaseEntity {
    // 节点名称
    private String name;

    // 节点路径，ltree类型
    @TableField(typeHandler = LTreeTypeHandler.class)
    private String path;

    // 节点中文路径
    private String cnPath;
    // 节点级别
    private String level;
    // 节点顺序
    private Integer sort;

    @TableField(exist = false)
    // 子节点列表
    private List<BaseCatalogNodeEntity> children = new ArrayList<>();
}
